package org.mosquitos.chat;

import java.io.File;
import java.io.IOException;

import net.jxta.discovery.DiscoveryService;
import net.jxta.exception.PeerGroupException;
import net.jxta.peergroup.PeerGroup;
import net.jxta.platform.NetworkManager;
import net.jxta.protocol.PipeAdvertisement;
import net.jxta.pipe.PipeService;

public class ServiceTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.setProperty("net.jxta.logging.Logging", "OFF");
		System.setProperty("net.jxta.level", "OFF"); 
		
        NetworkManager manager = null;
		try {
			manager = new NetworkManager(NetworkManager.ConfigMode.ADHOC, "ServiceTest",new File(new File(".cache"),"ServiceTest").toURI());
			manager.startNetwork();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (PeerGroupException e) {
			e.printStackTrace();
		}
        
        PeerGroup peerGroup = manager.getNetPeerGroup();
        
        //Thread aps = new Thread(new AdvertisementPublishService(peerGroup,AdvertisementCreator.createAdv(peerGroup, "pipe3", PipeService.UnicastType, null)));
        //aps.start();
        
        //Thread ads = new Thread(new AdvertisementDiscoveryService(peerGroup,DiscoveryService.ADV,PipeAdvertisement.NameTag,null));
        //ads.start();
        
        Thread pss = new Thread(new PipeSendService(peerGroup,null,"pipe4"));
        pss.start();
        
        //Thread prs = new Thread(new PipeReceiveService(peerGroup,"pipe4"));
        //prs.start();
	}

}
